////
////  StockDetailHeadTopView.swift
////  股票框架
////
////  Created by 李小骥 on 2017/10/12.
////  Copyright © 2017年 李小骥. All rights reserved.
////
//
//import UIKit
//import SceneKit
//class StockDetailHeadTopView: UIView {
////    现价
//
//    @IBOutlet var contView: UIView!
//    @IBOutlet weak var currentPriceLabel: UILabel!
////    涨跌额
//    @IBOutlet weak var changeLabel: UILabel!
////    涨跌幅
//    @IBOutlet weak var chgLabel: UILabel!
////    今开
//    @IBOutlet weak var todayOpenLabel: UILabel!
////    今开数值
//    @IBOutlet weak var todayOpenValueLabel: UILabel!
////    昨收
//    @IBOutlet weak var yesterdayCloseLabel: UILabel!
////    昨收数值
//    @IBOutlet weak var yesterdayCloseValueLabel: UILabel!
////    成交量
//    @IBOutlet weak var volumeLabel: UILabel!
////    成交量数值
//    @IBOutlet weak var volumeValueLabel: UILabel!
////    换手率
//    @IBOutlet weak var turnoverRateLabel: UILabel!
////    换手率数值
//    @IBOutlet weak var turnoverRateValueLabel: UILabel!
//    /*
//
//     // Only override draw() if you perform custom drawing.
//    // An empty implementation adversely affects performance during animation.
//    override func draw(_ rect: CGRect) {
//        // Drawing code
//    }
//    */
////    override init(frame: CGRect) {
////        super.init(frame: frame)
////        currentPriceLabel = UILabel(x: CURRENTPRICE_LABEL_X, y: CURRENTPRICE_LABEL_Y, height: CURRENTPRICE_LABEL_HEIGHT, text: "3.76", font: CURRENTPRICE_LABEL_FONT, aliment: .center, color: .APP)
////        self.backgroundColor = .red
////        self.frame = CGRect(x: 100, y: 100, width: 100, height: 100)
////    }
//
////    required init?(coder aDecoder: NSCoder) {
////        super.init(coder: aDecoder)
//////        fatalError("init(coder:) has not been implemented")
////    }
////    func printnib(){
////        print(Bundle.main.loadNibNamed("StockDetailHeadTopView", owner: self, options: nil))
////    }
////    class func instanceView() -> StockDetailHeadTopView {
////        return Bundle.main.loadNibNamed("StockDetailHeadTopView", owner: self, options: nil)?.last as! StockDetailHeadTopView
////    }
////    override func awakeFromNib() {
////        super.awakeFromNib()
////        print(self.subviews)
////        aabb.backgroundColor = .red
////        currentPriceLabel.textColor = .red
////        currentPriceLabel.text = "55555"
////        let st1 = UINib(nibName: "StockDetailHeadTopView", bundle: nil)
////        print("11111111111111111111111111111111")
////        print(st1)
////        let st2 = st1.instantiate(withOwner: self, options: nil)
////        print("22222222222222222222222222222222")
////        print(st2)
////        let st3 = st2.last
////        print("33333333333333333333333333333333")
////        print(st3)
//////        let stockDetailHeadTopView = UINib(nibName: "StockDetailHeadTopView", bundle: nil).instantiate(withOwner: self, options: nil).last as! StockDetailHeadTopView
//////        stockDetailHeadTopView.frame = self.bounds
////
//////        self.addSubview(stockDetailHeadTopView)
////    }
//    override func awakeFromNib() {
//        super.awakeFromNib()
//        //        print(self.subviews)
//
//    }
////    override init(frame: CGRect) {
////        super.init(frame: frame)
////        initFromXIB()
////    }
////
////    required init?(coder aDecoder: NSCoder) {
////        super.init(coder: aDecoder)
////        initFromXIB()
////    }
////    func initFromXIB() {
////        contView = UINib(nibName: (NSStringFromClass(type(of: self)).components(separatedBy: ".").last)!, bundle: Bundle(for: type(of: self))).instantiate(withOwner: self, options: nil).last as! UIView
////
////        contView.frame = bounds
////        self.addSubview(contView)
////    }
//    override init(frame: CGRect) {
//        super.init(frame: frame)
//        contView = UINib(nibName: (NSStringFromClass(type(of: self)).components(separatedBy: ".").last)!, bundle: nil).instantiate(withOwner: self, options: nil).last as! UIView
//        contView.backgroundColor = .red
//        contView.frame = bounds
//        addSubview(contView)
//    }
//
//    required init?(coder aDecoder: NSCoder){
//        super.init(coder: aDecoder)
//
//        //        print("11111111111111111111111111111111111NSStringFromClass(type(of: self))")
//        //        let containerNib = UINib(nibName: NSStringFromClass(type(of: self)), bundle: .main)
//        //        print(containerNib)
//        //        do{
//        //        let containerViews = try containerNib.instantiate(withOwner: self, options: nil)
//        //            print(containerViews)
//        //        }catch{
//        //            print(1111111111111111111111)
//        //            print(error.localizedDescription)
//        //        }
//        weak var weakSelf : StockDetailHeadTopView? = self
//        let nibName = (NSStringFromClass(type(of: self)).components(separatedBy: ".").last)!
//        print(nibName)
//        let nib = UINib(nibName: nibName, bundle: Bundle(for: type(of: self)))
//        let arr = nib.instantiate(withOwner: weakSelf, options: nil)
//        print(arr)
//        for (index,ite) in arr.enumerated(){
//            print("\(index);;;;;;;;;;;\(ite)++++++\(NSStringFromClass(type(of: ite) as! AnyClass))")
//        }
//        contView = arr.last as! UIView
//
//        //        let containerView = containerViews.first
//        //        print(containerView)
//        contView.frame = bounds
//        addSubview(contView)
//    }
//
//}










//
//  TEView.swift
//  te
//
//  Created by 李小骥 on 2017/10/12.
//  Copyright © 2017年 李小骥. All rights reserved.
//

import UIKit
import SceneKit
class StockDetailHeadTopView: UIView {
    @IBOutlet weak var containerView: UIView!
    @IBOutlet weak var currentPriceLabel: UILabel!
    //    涨跌额
    @IBOutlet weak var changeLabel: UILabel!
    //    涨跌幅
    @IBOutlet weak var chgLabel: UILabel!
    //    今开
    @IBOutlet weak var todayOpenLabel: UILabel!
    //    今开数值
    @IBOutlet weak var todayOpenValueLabel: UILabel!
    //    昨收
    @IBOutlet weak var yesterdayCloseLabel: UILabel!
    //    昨收数值
    @IBOutlet weak var yesterdayCloseValueLabel: UILabel!
    //    成交量
    @IBOutlet weak var volumeLabel: UILabel!
    //    成交量数值
    @IBOutlet weak var volumeValueLabel: UILabel!
    //    换手率
    @IBOutlet weak var turnoverRateLabel: UILabel!
    //    换手率数值
    @IBOutlet weak var turnoverRateValueLabel: UILabel!
    
    /*
     // Only override draw() if you perform custom drawing.
     // An empty implementation adversely affects performance during animation.
     override func draw(_ rect: CGRect) {
     // Drawing code
     }
     */
    override func awakeFromNib() {
        super.awakeFromNib()
        //        print(self.subviews)
        
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        containerView = UINib(nibName: (NSStringFromClass(type(of: self)).components(separatedBy: ".").last)!, bundle: nil).instantiate(withOwner: self, options: nil).last as! UIView
        containerView.backgroundColor = .red
        containerView.frame = bounds
        addSubview(containerView)
    }
    
    required init?(coder aDecoder: NSCoder){
        super.init(coder: aDecoder)
        
        //        print("11111111111111111111111111111111111NSStringFromClass(type(of: self))")
        //        let containerNib = UINib(nibName: NSStringFromClass(type(of: self)), bundle: .main)
        //        print(containerNib)
        //        do{
        //        let containerViews = try containerNib.instantiate(withOwner: self, options: nil)
        //            print(containerViews)
        //        }catch{
        //            print(1111111111111111111111)
        //            print(error.localizedDescription)
        //        }
        
        let nibName = (NSStringFromClass(type(of: self)).components(separatedBy: ".").last)!
        print(nibName)
        let nib = UINib(nibName: nibName, bundle: Bundle(for: type(of: self)))
        let arr = nib.instantiate(withOwner: self, options: nil)
        print(arr)
        for (index,ite) in arr.enumerated(){
            print("\(index);;;;;;;;;;;\(ite)++++++\(NSStringFromClass(type(of: ite) as! AnyClass))")
        }
        containerView = arr.last as! UIView
        
        //        let containerView = containerViews.first
        //        print(containerView)
        containerView.frame = bounds
        addSubview(containerView)
    }
    
}


